package com.example.onclock;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initview();
    }
    private void initview(){
        //获取ListView控件
        ListView customList=findViewById(R.id.custom_list);

        List<ContactModel>data=new ArrayList<>();

        //构造假数据
        for (int i = 0; i < 200000; i++) {
            ContactModel item=new ContactModel();
            item.setContactIcon(R.drawable.ic_launcher_background);
            item.setContactTitle("张三"+i);
            item.setContactMobile("188888888"+i);
            data.add(item);
        }

        //new出新建的CustomAdapter
        CustomAdapter adapter=new CustomAdapter(this);
        adapter.setData(data);
        customList.setAdapter(adapter);


    }
}